package API.Stream.MiddleMethod;

import java.util.Arrays;
import java.util.function.Function;

public class MapMethod {
    public static void main(String[] args) {
        String[] arr = new String[]{"Jack-10", "Alic-25", "Nick-40", "Black-90"};
        Arrays.stream(arr).map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                String[] word = s.split("-");
                return Integer.parseInt(word[1]);
            }
        }).forEach(s -> System.out.print(s + " "));
        System.out.println();
        Arrays.stream(arr).map(S -> {
            String[] word = S.split("-");
            return Integer.parseInt(word[1]);
        }).forEach(s -> System.out.print(s + " "));
    }
}
